package WaiBao;

import java.util.Arrays;

public class ZhangJiWen {
    public static void main(String[] args) {
        String[] name = {"郭杨恺(班长)", "李玉龙(副班长)", "小李(学习委员)", "王鹏发(文艺委员)", "赵敏", "杨根", "郭紫", "杨幂", "杨金婷", "李潇潇", "李子垭", "王子文",
                "李玟", "周迅", "陈奕迅", "洪金宝", "孙悟空", "猪八戒", "沙和尚", "唐僧", "白龙马", "高必", "洪金宝", "王勃", "小猪", "白岩松", "大白", "张国立",
                "何炅", "张荠文(学生)"};//考生本人:张荠文(学生)
        int[] age = {20, 22, 23, 19, 22, 20, 19, 21, 21, 20, 18, 18,19, 21, 20, 19, 18, 18, 20, 18, 19, 19, 20, 20, 20, 18, 21, 19, 21, 20};//考生本人年龄:20

        double[] xianyu1 = {84, 72, 76, 74, 97, 70, 78, 82, 81, 91, 91, 87, 85, 69, 65, 68, 69, 79, 96, 84, 92, 91, 95, 65, 75, 74, 95, 79, 68, 96};
        double[] xianyu2 = {77, 67, 75, 76, 85, 65, 68, 64, 74, 84, 72, 77, 66, 85, 85, 65, 76, 99, 76, 98, 72, 71, 95, 86, 74, 88, 84, 69, 77, 96};
        double[] xianyu3 = {79, 69, 82, 85, 75, 64, 73, 69, 80, 80, 93, 87, 85, 65, 69, 68, 69, 96, 96, 93, 92, 81, 65, 95, 76, 84, 77, 74, 85, 95};

        double yangyang1 ;//代表每个学生的总分
        double yangyang2;//代表每个学生的平均分
//        for (int i = 0; i < 30; i++) {
//            yangyang1 = xianyu1[i] +xianyu2[i] +xianyu3[i];
//            yangyang2 = (yangyang1 * 1.0) / 3;
//            System.out.println(name[i] + "的总分为:" + yangyang1);
//            System.out.println(name[i] + "的平均分为:" + yangyang2);
//        }


        double xiyang1 = 0, xiyang2 = 0;
        double[] xuexi = new double[30];
//        for (int i = 0; i < 30; i++) {
//            xiyang1= xianyu1[i] + xianyu2[i] + xianyu3[i];
//            xiyang2 = (xiyang1* 1.0) / 3;
//            xuexi[i] = xiyang2;
//        }
//
//        for (int i = 0; i < xuexi.length - 1; i++) {
//            for (int j = 0; j <  xuexi.length - i - 1; j++) {
//                if (xuexi[j] <xuexi[j + 1]) {
//                    double tep =xuexi[j];
//                    xuexi[j] = xuexi[j + 1];
//                    xuexi[j + 1] = tep;
//                }
//            }
//        }
//        System.out.println("前十名同学的成绩为:");
//        for (int i = 0; i < 10; i++) {
//            System.out.println(xuexi[i]);
//        }



        double kuaishou1 = 0,  kuaishou2 = 0, kuaishou3 = 0;//计算每门课的平均分
        double douying1 = 0, douying2 = 0, douying3 = 0;//计算每门课标准差
        double taote1 = 0,taote2 = 0, taote3 = 0;//计算每门课中位数
        double he = 0;
        for (int i = 0; i < xianyu1.length; i++) {
            he += xianyu1[i];
        }
        kuaishou1 = (he * 1.0) / 30;
        System.out.println("生物化学的班级平均分为:" +kuaishou1);
        double Sum = 0;
        for (int i = 0; i < xianyu2.length; i++) {
            Sum +=xianyu2[i];
        }
        kuaishou2 = (Sum * 1.0) / 30;
        System.out.println("微生物学的班级平均分为:" +  kuaishou2);
        double sum = 0;
        for (int i = 0; i <xianyu3.length; i++) {
            sum +=xianyu3[i];
        }
        kuaishou3 = (sum * 1.0) / 30;
        System.out.println("人体组织解剖学的班级平均分为:" +  kuaishou3);



        double c1 = 0, c2 = 0, c3 = 0;
        for (int i = 0; i <xianyu1.length; i++) {
            c1 += (xianyu1[i] -  kuaishou1) * (xianyu1[i] - kuaishou1);
        }
        douying1 = Math.sqrt(c1*1.0/30);
        System.out.println("生物化学的班级标准差为:" +douying1);
        for (int i = 0; i <xianyu2.length; i++) {
            c2 += (xianyu2[i] - kuaishou2) * (xianyu2[i] - kuaishou2);
        }
        douying2 = Math.sqrt(c2*1.0/30);
        System.out.println("微生物学的班级标准差为:" +douying2);

        for (int i = 0; i <xianyu3.length; i++) {
            c3 += (xianyu3[i] - kuaishou3) * (xianyu3[i] - kuaishou3);
        }
        douying3 = Math.sqrt(c3*1.0/30);
        System.out.println("人体组织解剖学的标准差为:" + douying3);
////////////
        Arrays.sort(xianyu1);
        Arrays.sort(xianyu2);
        Arrays.sort(xianyu3);
        taote1 = (xianyu1[15] + xianyu2[14]) * 1.0 / 2;
        taote2 = (xianyu2[15] + xianyu2[14]) * 1.0 / 2;
        taote3 = (xianyu3[15] + xianyu3[14]) * 1.0 / 2;
        System.out.println("生物化学的中位数为:" + taote1);
        System.out.println("微生物学的中位数为:" + taote2);
        System.out.println("人体组织解剖学的中位数为:" + taote3);



    }
}
